var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, a) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var a in t)
              Object.prototype.hasOwnProperty.call(t, a) && (e[a] = t[a]);
          })(t, a);
      };
      return function (t, a) {
        function o() {
          this.constructor = t;
        }
        if ("function" != typeof a && null !== a)
          throw new TypeError(
            "Class extends value " + String(a) + " is not a constructor or null"
          );
        e(t, a),
          (t.prototype =
            null === a
              ? Object.create(a)
              : ((o.prototype = a.prototype), new o()));
      };
    })(),
  TeamMessageController = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        (t.dataResult = []),
        t.btn_teamMsg_back.on(Laya.Event.CLICK, t, t.teamMessageBackPre),
        (t.list_groupTeam_message.selectEnable = !0),
        t.list_groupTeam_message.on(
          Laya.Event.CLICK,
          t,
          t.onDidClickMessageAction
        ),
        (t.list_groupTeam_message.vScrollBarSkin = ""),
        WebSocketService.addListener({
          caller: t,
          code: 42061,
          method: t.onLoadTeamMessageData,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 42062,
          method: t.onLoadTeamMessageData,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 42092,
          method: t.onLoadTeamMsgOpt,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 42091,
          method: t.onLoadTeamMsgOpt,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 42082,
          method: t.onLoadTeamMsgOpt,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 42081,
          method: t.onLoadTeamMsgOpt,
        }),
        t
      );
    }
    return (
      __extends(t, e),
      (t.openView = function () {
        return (
          null == this.teamMsgVC && (this.teamMsgVC = new t()),
          WebSocketService.send({ c: 42061 }),
          WebSocketService.send({ c: 42062 }),
          (this.teamMsgVC.dataResult = []),
          (this.teamMsgVC.list_groupTeam_message.visible = !1),
          this.teamMsgVC
        );
      }),
      (t.prototype.onLoadTeamMessageData = function (e) {
        if (42061 == e.act_id) {
          if (0 == e.code && e.data) {
            this.list_groupTeam_message.visible = !0;
            for (var t = void 0, a = 0; a < e.data.length; a++) {
              (t = {
                label_team_title1: {
                  text: (o = e.data[a]).userName + "邀请您加入队伍",
                },
                inviterRoleId: o.inviterRoleId,
                isInvite: o.isInvite,
                roleId: o.roleId,
                userName: o.userName,
              }),
                this.dataResult.push(t);
            }
            this.list_groupTeam_message.dataSource = this.dataResult;
          }
        } else if (42062 == e.act_id && 0 == e.code && e.data) {
          this.list_groupTeam_message.visible = !0;
          for (var t = void 0, a = 0; a < e.data.length; a++) {
            var o = e.data[a];
            (t = {
              label_team_title1: { text: o.userName + "申请加入您的队伍" },
              inviterRoleId: o.inviterRoleId,
              isInvite: o.isInvite,
              roleId: o.roleId,
              userName: o.userName,
            }),
              this.dataResult.push(t);
          }
          this.list_groupTeam_message.dataSource = this.dataResult;
        }
      }),
      (t.prototype.onDidClickMessageAction = function (e) {
        if ((console.log(e.target.name), "" != e.target.name)) {
          var t = "",
            a = this.list_groupTeam_message.selectedItem;
          a.roleId,
            (t = a.inviterRoleId),
            "item0" == e.target.name
              ? 1 == a.isInvite
                ? WebSocketService.send({ c: 42092, d: { roleId: t } })
                : WebSocketService.send({ c: 42082, d: { roleId: t } })
              : "item1" == e.target.name &&
                (1 == a.isInvite
                  ? WebSocketService.send({ c: 42091, d: { roleId: t } })
                  : WebSocketService.send({ c: 42081, d: { roleId: t } }),
                WebSocketService.send({ c: 4199 }));
        }
      }),
      (t.prototype.getParenthesesStr = function (e) {
        var t = e.match(/\((.+?)\)/g)[0];
        return t.substring(1, t.length - 1);
      }),
      (t.prototype.onLoadTeamMsgOpt = function (e) {
        ToastView.toastView(e.msg),
          42091 == e.act_id
            ? WebSocketService.send({ c: 4199 })
            : 42081 == e.act_id &&
              Laya.stage.event("ChatRoomView", {
                name: "group_team",
                data: "team",
              }),
          (this.dataResult = []),
          WebSocketService.send({ c: 42061 }),
          WebSocketService.send({ c: 42062 });
      }),
      (t.prototype.teamMessageBackPre = function () {
        this.removeSelf();
      }),
      t
    );
  })(ui.MessageController.TeamMessageControllerUI);
